{% extends 'baseh.html' %}
{% load static %}
{% block title %}{{ column }}{% endblock %}
{% block content %}
    <div class="center-block">
        <div class="col-md-2" style="width: fit-content">
            <h1 style="width: min-content;font-size:75px;font-family: 华文新魏,sans-serif;margin-top:50px;margin-bottom: 50px;">{{ column }}栏目</h1>
        </div>
    <div class="center col-md-10" style="margin-right:30px;margin-left:30px;">
        <p class="text-right" style="margin-top:15px"><button class="btn btn-primary" onclick="toPostArticle()">发布文章</button></p>
        <table class="table table-hover">
        <tr>
            <th style="font-size: medium">序号</th>
            <th style="font-size: medium">文章标题</th>
            <th style="font-size: medium">作者</th>
            <th style="font-size: medium">发表时间/修改时间</th>
            <th style="font-size: medium">操作</th>
        </tr>
        {% for a in a_list %}
        <tr>
            <td>{{ forloop.counter }}</td>
            <td><a href="{% url 'article:show_column_article' %}?a_id={{ a.id }}">{{ a.title }}</td>
            <td><a href="{% url 'article:user_articles' %}?author_id={{ a.u_id }}">{{ a.u.username }}</a></td>
            <td>{{ a.created }}</td>
            <td>
                <a name="edit" href="javascript:" onclick="edit_column(this, {{ a.id }})">
                <span class="glyphicon glyphicon-pencil"></span>
                </a>
                <a name="delete" href="javascript:" onclick="del_column(this, {{ a.id }})">
                    <span class="glyphicon glyphicon-trash" style="margin-left:20px; "></span>
                </a>
            </td>
        </tr>
        {% empty %}
        <p>还没有发布 " {{ column }} " 相关文章，太懒了。</p>
        {% endfor %}
        </table>
    </div>
    </div>
{% endblock %}
{% block jsFiles %}
    <script type="text/javascript">
        function toPostArticle(){
            location.href="{% url 'article:article_post' %}?column={{ column }}"
        }
    </script>
{% endblock %}